﻿using System;
using System.Collections.Generic;

namespace WeiSha.Core
{
	// Token: 0x02000004 RID: 4
	public class Database
	{
		// Token: 0x06000014 RID: 20 RVA: 0x000027FC File Offset: 0x000009FC
		public static Dictionary<string, int> TableCount()
		{
			MemoryCache @default = MemoryCache.Default;
			Dictionary<string, int> dictionary = @default.Get(Database.cachename) as Dictionary<string, int>;
			bool flag = dictionary != null;
			Dictionary<string, int> dictionary2;
			if (flag)
			{
				dictionary2 = dictionary;
			}
			else
			{
				dictionary2 = null;
			}
			return dictionary2;
		}

		// Token: 0x06000015 RID: 21 RVA: 0x00002834 File Offset: 0x00000A34
		public static Dictionary<string, int> TableCount(Dictionary<string, int> dic)
		{
			MemoryCache @default = MemoryCache.Default;
			bool flag = @default.Contains(Database.cachename);
			if (flag)
			{
				@default.Remove(Database.cachename);
			}
			@default.Add(Database.cachename, dic, DateTimeOffset.UtcNow.AddHours(24.0), null);
			return dic;
		}

		// Token: 0x06000016 RID: 22 RVA: 0x0000288C File Offset: 0x00000A8C
		public static int TableCount(string tbname)
		{
			Dictionary<string, int> dictionary = Database.TableCount();
			bool flag = dictionary != null;
			if (flag)
			{
				foreach (KeyValuePair<string, int> keyValuePair in dictionary)
				{
					bool flag2 = keyValuePair.Key.Equals(tbname, StringComparison.CurrentCultureIgnoreCase);
					if (flag2)
					{
						return keyValuePair.Value;
					}
				}
			}
			return 0;
		}

		// Token: 0x17000003 RID: 3
		// (get) Token: 0x06000017 RID: 23 RVA: 0x0000290C File Offset: 0x00000B0C
		public static bool TableCountCacheExist
		{
			get
			{
				return MemoryCache.Default.Contains(Database.cachename);
			}
		}

		// Token: 0x17000004 RID: 4
		// (get) Token: 0x06000018 RID: 24 RVA: 0x0000291D File Offset: 0x00000B1D
		// (set) Token: 0x06000019 RID: 25 RVA: 0x00002924 File Offset: 0x00000B24
		public static DateTime TableCountCalcTime { get; set; }

		// Token: 0x17000005 RID: 5
		// (get) Token: 0x0600001A RID: 26 RVA: 0x0000292C File Offset: 0x00000B2C
		// (set) Token: 0x0600001B RID: 27 RVA: 0x00002933 File Offset: 0x00000B33
		public static DateTime InitialDate { get; set; }

		// Token: 0x17000006 RID: 6
		// (get) Token: 0x0600001C RID: 28 RVA: 0x0000293B File Offset: 0x00000B3B
		// (set) Token: 0x0600001D RID: 29 RVA: 0x00002942 File Offset: 0x00000B42
		public static string DbType { get; set; }

		// Token: 0x04000003 RID: 3
		private static string cachename = "record_count_for_all_tables_in_the_database";
	}
}
